import { request } from './request';

export function getUserList(queryInfo) {
  return request({
    url: 'users',
    params: queryInfo
  });
}

export function updateUserState(userId, userState) {
  return request({
    method: 'put',
    url: `users/${userId}/state/${userState}`
  });
}

export function addUser(addForm) {
  return request({
    method: 'post',
    url: 'users',
    data: addForm
  })
}

export function queryUserInfoById(userId) {
  return request({
    url: `users/${userId}`
  });
}

export function editUserSubmit(editForm) {
  const {id, email, mobile} = editForm;
  return request({
    method: 'put',
    url: `users/${id}`,
    data: {
      email, mobile
    }
  });
}

export function deleteUserById(userId) {
  return request({
    method: 'delete',
    url: `users/${userId}`
  });
}
